package com.fengycx.pojo.vo;

import com.fengycx.pojo.domain.Order;
import com.fengycx.pojo.domain.OrderBill;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;
import java.util.Date;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class OrderDetailVo {
    private String driverPhoto;
    private String driverName;
    private String driverPhone;
    private String startPlace;
    private String endPlace;
    private String orderNo;
    private Date createTime;
    private Date favourFee;
    private String carType;
    private String carPlate;
    private BigDecimal expectsMileage;
    private BigDecimal baseMileage;
    private BigDecimal baseMileageAmount;
    private BigDecimal exceedBaseReturnEveryKmAmount;
    private BigDecimal expectsOrderAmount;
    private Integer waitingMinute;
    private Integer freeBaseWaitingMinute;
    private BigDecimal exceedEveryMinuteAmount;
    private BigDecimal waitingAmount;
    private BigDecimal freeBaseReturnMileage;
    private BigDecimal returnAmont;
    //订单实际金额
//    private BigDecimal realOrderAmount;

    //超出基础里程数量
    public BigDecimal getExceedBaseMileage(){
        if(this.expectsMileage.compareTo(this.baseMileage)>0){
        return  this.expectsMileage.subtract(this.baseMileage);
        }else {
            return BigDecimal.ZERO;
        }
    }

    //超出免费的等待时长
    public Integer getExceedWaitMinute(){
        Integer exceedMinute = this.waitingMinute - this.freeBaseWaitingMinute;
        if (exceedMinute>0) {
            return exceedMinute;
        }
        return 0;
    }

    //超出免费返程公里数
    public BigDecimal getExceedFreeReturnMileage(){
        BigDecimal subtract = this.expectsMileage.subtract(this.freeBaseReturnMileage);
        if (subtract.compareTo(BigDecimal.ZERO)>0) {
            return subtract;
        }
        return BigDecimal.ZERO;
    }
}
